package com.start.quartz.scheduling;

import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;

public abstract class StartQuartzJobBean extends QuartzJobBean {
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap();
        executeTask(jobExecutionContext, jobDataMap);
    }

    /**
     * 任务执行
     *
     * @param jobExecutionContext 任务上下文环境
     * @param jobDataMap          任务数据
     */
    protected abstract void executeTask(JobExecutionContext jobExecutionContext, JobDataMap jobDataMap);
}
